using System;
using System.Collections.Generic;
using OrbitOne.CRMLyncInfoDashboard.CRM.OData;

namespace OrbitOne.CRMLyncInfoDashboard.Shell
{
    public class SavedQueryDisplayItem 
    {
        public SavedQueryDisplayItem(List<DisplayColumn> values, IEntityModel parentEntityModel)
        {
            Values = values;
            ParentEntityModel = parentEntityModel;
            PictureLocation = GetPictureLocation();
        }

        private string GetPictureLocation()
        {
            switch (ParentEntityModel.ModelType)
            {
                case EntityModelTypes.AccountModel:
                    return GetImage("ico_16_1.png");
                case EntityModelTypes.ContactModel:
                    return GetImage("ico_16_2.png");
                case EntityModelTypes.LeadModel:
                    return GetImage("ico_16_4.png");
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }

        private static string GetImage(string imageName)
        {
            return string.Format("{0}/{1}", "../Images", imageName);
        }

        public string PictureLocation { get; private set; }
        public List<DisplayColumn> Values { get; private set; }
        public IEntityModel ParentEntityModel { get; private set; }
    }
}